/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.upc.connect;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author GABY
 */
public class ConnectDb {

    private String database;

    public Connection getConnection() {
        Connection cn = null;

        try {

            Class.forName("org.postgresql.Driver").newInstance();
            cn = DriverManager.getConnection(
                    "jdbc:postgresql://localhost:5432/" + database,
                    "postgres", "admin");

        } catch (SQLException e) {
        } catch (Exception e) {
        }
        return cn;

    }
    
    public ConnectDb() {
        this.database = "data"; //** colocar nombre de la base de datos
    }

    public ConnectDb(String database) {
        this.database = database;
    }
}
